import Vue from 'vue';
import VueRouter from 'vue-router';

import LoginCmpt from 'mdls/login';
import IndexContainer from 'mdls/containers';

Vue.use(VueRouter);

const routes = [

  {
    path: '/public',
    component: LoginCmpt,
    children: require('./public').default,
  },

  {
    path: '/private',
    component: IndexContainer,
    children: require('./private').default,
    beforeEnter: (to, from, next) => {
      // TODO: permission check
      next();
    }
  },

  {
    path: '*',
    redirect: '/public/login'
  }

];

const appRouter = new VueRouter({
  mode: 'hash',
  routes
});

export default appRouter;
